package com.slz3.business.module.configManagement.conZoneTemplate.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.configManagement.conZoneTemplate.domain.ConZoneTemplate;
import com.slz3.business.module.configManagement.conZoneTemplate.domain.ConZoneTemplateCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class ConZoneTemplateResController {

    @Resource
    private ConZoneTemplateResAtomic conZoneTemplateResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, ConZoneTemplate conZoneTemplate) {
        if (ConZoneTemplateResUnsafeValid.add(req, conZoneTemplate)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTemplateResAtomic.add_$ConZoneTemplateUpdateLock(req, conZoneTemplate);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, ConZoneTemplateCondition conZoneTemplateCondition) {
        if (ConZoneTemplateResUnsafeValid.delete(req, conZoneTemplateCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTemplateResAtomic.delete_$ConZoneTemplateUpdateLock(req, conZoneTemplateCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, ConZoneTemplate conZoneTemplate) {
        if (ConZoneTemplateResUnsafeValid.modify(req, conZoneTemplate)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTemplateResAtomic.modify_$ConZoneTemplateUpdateLock(req, conZoneTemplate);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (ConZoneTemplateResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return ConZoneTemplateResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return conZoneTemplateResAtomic.info_$ConZoneTemplateUpdateLock(req);
        if (ConZoneTemplateResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTemplateResAtomic.info_$ConZoneTemplateUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (ConZoneTemplateResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return ConZoneTemplateResExecutor.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, ConZoneTemplateCondition conZoneTemplateCondition) {
        //
        if (ConZoneTemplateResUnsafeValid.auditSubmit(req, conZoneTemplateCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTemplateResAtomic.auditSubmit_$ConZoneTemplateUpdateLock(req, conZoneTemplateCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, ConZoneTemplateCondition conZoneTemplateCondition) {
        if (ConZoneTemplateResUnsafeValid.audit(req, conZoneTemplateCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTemplateResAtomic.audit_$ConZoneTemplateUpdateLock(req, conZoneTemplateCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, ConZoneTemplateCondition conZoneTemplateCondition) {
        if (ConZoneTemplateResUnsafeValid.auditReject(req, conZoneTemplateCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTemplateResAtomic.auditReject_$ConZoneTemplateUpdateLock(req, conZoneTemplateCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, ConZoneTemplateCondition conZoneTemplateCondition) {
        if (ConZoneTemplateResUnsafeValid.usingEnable(req, conZoneTemplateCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTemplateResAtomic.usingEnable_$ConZoneTemplateUpdateLock(req, conZoneTemplateCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, ConZoneTemplateCondition conZoneTemplateCondition) {
        if (ConZoneTemplateResUnsafeValid.usingDisable(req, conZoneTemplateCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTemplateResAtomic.usingDisable_$ConZoneTemplateUpdateLock(req, conZoneTemplateCondition);
        }
    }

}
